<?php
namespace Admin\Controller;
use Think\Controller;
class MessageController extends CommonController {
	public function index(){
		$m=D('Message');
		$data = $m -> pages();
		//dump($data);
		$this -> assign('page',$data['page']);
		$this -> assign('list',$data['list']);
		$this -> display();	
	}
	public function edit($id){
		//dump($id);
		$model=D('Message');
		$data =$model -> edit($id);
		$this->assign('message',$data);
		//dump($data);
		$this->display();
	}
	public function del($id){
		if(M('Message')->where(array('id'=>$id))->delete()){
			echo "<script>alert('删除成功');window.location.href='".U('Message/index')."'</script>";
		}else{
			echo "<script>alert('提交失败!请联系管理员');window.location.href='".U('Message/index')."'</script>";
		}
	}
}
?>